<template>

  <div>
    <el-table
        :data="tableData"
        style="width: 100%">
      <el-table-column
          prop="date"
          label="日期"
          width="180">
      </el-table-column>
      <el-table-column
          prop="name"
          label="姓名"
          width="180">
      </el-table-column>
      <el-table-column
          prop="address"
          label="地址">
      </el-table-column>
      <el-table-column
          prop="address"
          label="地址">
      </el-table-column>
    </el-table>

  <el-pagination
      background
      layout="prev, pager, next"
      @current-changepage="changePage"
      :page-sizes="size"
      :total="total">
  </el-pagination>
</div>
</template>

<script>
export default {
  name: "Main",

  data() {
    return {
      tableData: [],
      total: 0,
      size: 2

    }
  },
  data1:{//在data中创建对象，然后我们post请求中携带过去
    wx:{
      openid:null,
      headimgurl:null,
      nickname:null,
      unionid:null,
      phone:null,
      password:null
    }
  },
  mounted(){
    this.$axios.post("/list",this.$qstring.stringify({page:this.page,row:this.size})).then(
        res=>{
          this.tableData=res.data.data,
              this.total=res.data.total,
              this.size=res.data.size
        }
    )
  },

  methods:{
     changePage(page){
       this.$axios.post("/list",this.$qstring.stringify({page:page,row:this.size})).then(
           res=>{
             this.tableData=res.data.data,
                 this.total=res.data.total,
                 this.size=res.data.size
           }
       )
     }

  }

}
</script>

<style scoped>

</style>